package com.changgou.goods.feign;

import com.changgou.entity.Result;
import com.changgou.goods.pojo.Category;
import com.changgou.goods.pojo.Sku;
import com.changgou.goods.pojo.Spu;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * @Author Tang
 * @Date 2020/9/16 14:29
 * @Description
 */
//name: 微服务的名称，用于服务发现
@FeignClient(name = "goods")
public interface SkuFeign {
    /**
     * 将该请求资源对外暴露,被search微服务通过feign远程调用
     * @param spuId
     * @return
     */
    @GetMapping("/sku/spu/{spuId}")
    public List<Sku> findSkuListBySpuId(@PathVariable("spuId") String spuId);

    /**
     * 根据分类id查询分类信息,被page服务远程调用
     * @param id
     * @return
     */
    @GetMapping("/category/{id}")
    public Result<Category> findById(@PathVariable("id") Integer id);

    /**
     * 根据spuId查询spu对象,被page服务远程调用
     * @param id
     * @return
     */
    @GetMapping("/spu/findSpuById/{id}")
    public Result<Spu> findSpuById(@PathVariable("id") String id);

}
